package com.ivncorp.evnproject;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.Display;
import android.widget.ImageView;

import com.ivncorp.evnproject.helpers.Utils;

public class ActivityFullScreenImageOffline extends Activity {

	private String uri;
	private ImageView ivthum;
	private Bitmap bitmap = null;

	@SuppressWarnings("deprecation")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_full_screen_image);

		ivthum = (ImageView) findViewById(R.id.imgDisplay);
		Intent intent = getIntent();

		Display display = getWindowManager().getDefaultDisplay();
		uri = intent.getStringExtra("url");
		if (uri != null) {
			bitmap = Utils.decodeFile(uri, display.getWidth(),
					display.getHeight());
			
			ivthum.setImageBitmap(bitmap);
		}

	}

	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		overridePendingTransition(R.anim.bottom_in, R.anim.top_out);
		super.onStop();
	}

	@Override
	public void onBackPressed() {
		finish();
		super.onBackPressed();
	}

	@Override
	protected void onDestroy() {
		if (bitmap != null) {
			bitmap.recycle();
			bitmap = null;
		}
		super.onDestroy();
	}

}
